import { CommonEntity } from '../../../../util/entity/common.entity';
import { Column, Entity, ManyToOne } from 'typeorm';
import { User } from '../../../admin/user/entities/user.entity';
import { TransformBigint } from '../../../../util/common-fn';

@Entity('dnf_user_item')
export class UserItem extends CommonEntity {
  @Column({ comment: '物品名称' })
  name: string;
  @Column({ comment: '物品类型1-增幅器 2-矛盾' })
  itemType: number; // 物品类型1-增幅器 2-矛盾
  @Column({
    transformer: new TransformBigint(),
    type: 'bigint',
    comment: '物品数量',
  })
  itemNum: number; // 物品数量

  constructor(name: string, itemType: number, itemNum: number) {
    super();
    this.name = name;
    this.itemType = itemType;
    this.itemNum = itemNum;
  }

  @ManyToOne(() => User, (user) => user.userItems)
  user: User;
}
